home *** CD-ROM | disk | FTP | other *** search
- Path: camelot.dsccc.com!kcline
- From: kcline@sun132.spd.dsccc.com (Kevin Cline)
- Newsgroups: comp.lang.ada,comp.lang.c++
- Subject: Re: some questions re. Ada/GNAT from a C++/GCC user
- Date: 2 Apr 1996 15:37:04 GMT
- Organization: DSC Communications Corporation Switch Products Division
- Message-ID: <4jrhj0$lqd@tpd.dsccc.com>
- References: <wnewmanDoxrCp.DKv@netcom.com> <Dp1oAw.7Cz@world.std.com> <4jlj79$h1k@Nntp1.mcs.net> <Dp75DK.DMG@world.std.com>
- NNTP-Posting-Host: sun132.spd.dsccc.com
-
- In article <Dp75DK.DMG@world.std.com>,
- Robert A Duff <bobduff@world.std.com> wrote:
- >Well, I'm not sure exactly what you're asking. To print stuff out, you
- >need some procedure that prints text strings, and you need some way to
- >convert whatever you want to print out into a text string. In Ada,
- >'Image is used to convert simple data types like Integer and Float into
- >human-readable Strings. For complicated data types, you write your own
- >Image function.
-
- This is a flaw in the Ada language design, IMHO. Why should
- different methods be used to externalize primitive and user-defined types?
- It certainly makes program maintainence more difficult; imagine a change
- from
-
- type sequence_number_type is 0..2**32-1
-
- to
-
- type sequence_number_type is
- record
- time: time_type;
- serial: 2**32-1;
- end;
-
- If this change was not anticipated then every use of 'IMAGE to
- output a sequence number must be changed to IMAGE().
-
- >The "&" operator just concatenates Strings. So to
- >print out some stuff, you write:
- >
- > Put("X = " & Integer'Image(X) & "; and List = " & Image(List));
- >
-
- Sloshing all those characters around unnecessarily gets a bit
- expensive after a while. This expression is likely to copy the list
- image twice before it is actually output.
- --
- Kevin Cline
-